import instance from './http'
import qs from 'qs'
import vue from '@/main'
import store from '@/store'
const get = (url,params) =>{
    return instance.get(url,{params:doParams(params)})
}

const post = (url,params) =>{
    return instance.post(url,params)
}
function doParams(params){
    // params.language = store.state.language;
    if(store.state.hasLogin){
        params.aid = store.state.userInfo.id;
    }
    if(!params.correlationid && store.state.userInfo.correlationid){
        params.correlationid = store.state.userInfo.correlationid;
    }
    if(store.state.userInfo.applycorrelationid){
        params.applycorrelationid = store.state.userInfo.applycorrelationid;
    }
    if(store.state.userInfo.xtype){
        params.xtype = store.state.userInfo.xtype;
    }
    return params
}
export default {
    get,post
}